define([
  'jquery', 
  'underscore', 
  'backbone',
  'text!templates/contact.html'
  ], function($, _, Backbone, contactViewTemplate){
	var ContactView = Backbone.View.extend({
		el: $("#content"),
		
		template: _.template(contactViewTemplate),
		

		render: function() {
			this.$el.html(this.template);
			this.input = this.$("#mail");
			var id = this.id;
			if (id) {
				var modelObj = ItemCollection.where({_id:id});
				if (modelObj.length > 0) {
					this.model = modelObj[0];
					this.input.val(this.model.get("email"));
				} else {
					this.model = new ContactModel();
				}
			}			
			
		},

	});
	return ContactView;
});